//
//  YZNetworkManager.h
//  VET
//
//  Created by Lam BG on 2018/6/26.
//  Copyright © 2018年 YZ. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "YZNetWorkRequestManager.h"

@interface YZNetworkManager : NSObject

typedef NS_ENUM(NSInteger, YZHTTPMethod) {

    GET,
    POST,
    PUT,
    DELETE,
    PATCH
};

SingletonH

#pragma mark - 网络请求

/**
 根据 method 发起请求

 @param url 请求地址
 @param params 请求参数
 @param method 请求方式
 @return 请求回调的信号
 */
- (RACSignal*)requestURL:(NSString*)url whitParams:(NSDictionary *)params withHeaders:(NSDictionary *)headers withMethod:(YZHTTPMethod)method;

/**
 发起请求 get（获取）

 @param url 请求地址
 @param params 请求参数
 @return 请求回调的信号
 */
- (RACSignal*)getURL:(NSString*)url whitParams:(NSDictionary *)params withHeaders:(NSDictionary *)headers;

/**
 发起请求 post（新增）
 
 @param url 请求地址
 @param params 请求参数
 @return 请求回调的信号
 */
- (RACSignal*)postURL:(NSString*)url whitParams:(NSDictionary *)params withHeaders:(NSDictionary *)headers;

/**
 发起请求 put（更新）
 
 @param url 请求地址
 @param params 请求参数
 @return 请求回调的信号
 */
- (RACSignal*)putURL:(NSString*)url whitParams:(NSDictionary *)params withHeaders:(NSDictionary *)headers;

/**
 发起请求 delete（删除）
 
 @param url 请求地址
 @param params 请求参数
 @return 请求回调的信号
 */
- (RACSignal*)deleteURL:(NSString*)url whitParams:(NSDictionary *)params withHeaders:(NSDictionary *)headers;

/**
 发起请求 上传图片
 
 @param url 请求地址
 @param params 请求参数
 @return 请求回调的信号
 */
- (RACSignal*)uploadImgWithUrl:(NSString*)url params:(NSDictionary *)params withHeaders:(NSDictionary *)headers img:(UIImage*)image imgPath:(NSString*)path apiKey:(NSString*)key;

#pragma mark -- 非RAC请求

/**
 多图片上传
 */
+ (void)uploadImgsWithApi:(NSString*)api params:(NSDictionary *)params imgs:(NSArray<UIImage *> *)images name:(NSString *)name withHeaders:(NSDictionary *)headers success:(YZNetworkCompletionSuccessBlock)successBlock fail:(YZNetworkCompletionFailBlock)failBlock;

/**
 本地路劲视频上传
 */
+ (void)uploadVideoWithApi:(NSString*)api params:(NSDictionary *)params videoPath:(NSString *)videoPath name:(NSString *)name withHeaders:(NSDictionary *)headers success:(YZNetworkCompletionSuccessBlock)successBlock fail:(YZNetworkCompletionFailBlock)failBlock;

/**
 视频上传
 */
+ (void)uploadVideoWithApi:(NSString*)api params:(NSDictionary *)params videoUrl:(NSURL *)videoUrl name:(NSString *)name withHeaders:(NSDictionary *)headers success:(YZNetworkCompletionSuccessBlock)successBlock fail:(YZNetworkCompletionFailBlock)failBlock;

/**
 post请求
 */
+ (void)postWithApi:(NSString*)api params:(NSDictionary *)params withHeaders:(NSDictionary *)headers success:(YZNetworkCompletionSuccessBlock)successBlock fail:(YZNetworkCompletionFailBlock)failBlock;

/**
get请求
 */
+ (void)getWithApi:(NSString*)api params:(NSDictionary *)params withHeaders:(NSDictionary *)headers success:(YZNetworkCompletionSuccessBlock)successBlock fail:(YZNetworkCompletionFailBlock)failBlock;

#pragma mark - 实时检测网络状态

+ (void)startMonitoring;
+ (void)stopMonitoring;

@end
